from selenium import webdriver
from selenium.webdriver.common.by import By
from time import sleep

# 弹窗内输入内容 需要使用firefox浏览器
driver = webdriver.Firefox()
driver.get(r"file:///D:/QQ(%E6%96%B0%E7%89%88)/%E6%96%87%E4%BB%B6/prompt.html")
driver.maximize_window()
sleep(2)

driver.find_element(By.ID,'button').click()
sleep(2)
alert = driver.switch_to.alert
alert.send_keys('prompt弹窗')
sleep(1)
alert.accept()
# alert.dismiss()

sleep(5)
driver.quit()